package com.telnetnz.ticketdesk.bean;

import com.telnetnz.ticketdesk.dao.entity.TicketToTagEntity;
import com.telnetnz.ticketdesk.service.TagService;
import com.telnetnz.ticketdesk.service.TicketService;

public class TicketToTag extends TicketToTagEntity {

	private static final long serialVersionUID = -8245409878613377466L;

	public Ticket getTicket() {
		return TicketService.getTicket(getTicketId());
	}

	public Tag getTag() {
		return TagService.getTag(getTagId());
	}

	public static TicketToTag adapt(TicketToTagEntity entity) {
		if (entity == null)
			return null;
		TicketToTag bean = new TicketToTag();
		bean.setTicketId(entity.getTicketId());
		bean.setTagId(entity.getTagId());
		bean.setTagName(entity.getTagName());
		return bean;
	}

	public TicketToTagEntity toEntity() {
		return this;
	}
}